#pragma once

#include "kwdb/config.h"
#include <grpcpp/grpcpp.h>
#include <memory>
#include <string>

namespace kwdb {
namespace security {

/**
 * @brief Base64 encode a string
 * @param input Input string to encode
 * @return Base64 encoded string
 */
std::string base64_encode(const std::string& input);

/**
 * @brief Create gRPC channel credentials based on security configuration
 * @param config Security configuration
 * @return Shared pointer to channel credentials
 */
std::shared_ptr<grpc::ChannelCredentials> create_channel_credentials(
    const SecurityConfig& config);

/**
 * @brief Add authentication metadata to gRPC ClientContext
 * @param context gRPC client context
 * @param config Security configuration
 */
void add_auth_metadata(grpc::ClientContext& context, const SecurityConfig& config);

} // namespace security
} // namespace kwdb
